.data
str0:
.asciiz "while error!"
str1:
.asciiz "break error!"
str2:
.asciiz "continue error!"
str3:
.asciiz "b="
str4:
.asciiz "\n"
str5:
.asciiz "\n"
str6:
.asciiz "\n"
str7:
.asciiz "testBlock : b="
str8:
.asciiz "\n"
str9:
.asciiz "19231177\n"
str10:
.asciiz "result = "
str11:
.asciiz "\n"
str12:
.asciiz "1 2 3 4 sum is : "
str13:
.asciiz "\n"
str14:
.asciiz "line"
str15:
.asciiz " is:"
str16:
.asciiz ";line"
str17:
.asciiz " is : "
str18:
.asciiz ";  line"
str19:
.asciiz " is : "
str20:
.asciiz ";\n"
str21:
.asciiz "+2=3\n"
str22:
.asciiz "+"
str23:
.asciiz "="
str24:
.asciiz "\n"
str25:
.asciiz "19231177\n"
.text
main_begin:
block_begin_34:
la $4 str9
li $2 4
syscall
sw $31 0($sp)
subi $sp $sp 4
jal testWhile
addi $sp $sp 4
lw $31 0($sp)
sw $31 0($sp)
subi $sp $sp 4
jal testIf
addi $sp $sp 4
lw $31 0($sp)
sw $31 0($sp)
subi $sp $sp 4
jal testIO
addi $sp $sp 4
lw $31 0($sp)
sw $31 0($sp)
subi $sp $sp 4
jal testBlock
addi $sp $sp 4
lw $31 0($sp)
sw $31 0($sp)
li $20 5
sw $20 -4($sp)
subi $sp $sp 8
jal testRecurrence
addi $sp $sp 8
lw $31 0($sp)
lw $20 -4($sp)
move $20 $2
la $4 str10
li $2 4
syscall
move $4 $20
li $2 1
syscall
la $4 str11
li $2 4
syscall
li $20 1
li $10 0
sll $10 $10 2
sw $20 0x10040000($10)
li $20 2
li $10 1
sll $10 $10 2
sw $20 0x10040000($10)
li $20 3
li $10 2
sll $10 $10 2
sw $20 0x10040000($10)
li $20 4
li $10 3
sll $10 $10 2
sw $20 0x10040000($10)
sw $31 0($sp)
li $20 4
sw $20 -4($sp)
li $20 0x10040000
sw $20 -8($sp)
subi $sp $sp 12
jal getSumOfArray
addi $sp $sp 12
lw $20 -8($sp)
lw $31 0($sp)
lw $20 -4($sp)
move $20 $2
la $4 str12
li $2 4
syscall
move $4 $20
li $2 1
syscall
la $4 str13
li $2 4
syscall
li $20 1
li $10 0
sll $10 $10 2
sw $20 0x10040010($10)
li $20 2
li $10 1
sll $10 $10 2
sw $20 0x10040010($10)
li $20 3
li $10 2
sll $10 $10 2
sw $20 0x10040010($10)
li $20 10
li $10 3
sll $10 $10 2
sw $20 0x10040010($10)
li $20 20
li $10 4
sll $10 $10 2
sw $20 0x10040010($10)
li $20 30
li $10 5
sll $10 $10 2
sw $20 0x10040010($10)
li $20 100
li $10 6
sll $10 $10 2
sw $20 0x10040010($10)
li $20 200
li $10 7
sll $10 $10 2
sw $20 0x10040010($10)
li $20 300
li $10 8
sll $10 $10 2
sw $20 0x10040010($10)
li $20 1000
li $10 9
sll $10 $10 2
sw $20 0x10040010($10)
li $20 2000
li $10 10
sll $10 $10 2
sw $20 0x10040010($10)
li $20 3000
li $10 11
sll $10 $10 2
sw $20 0x10040010($10)
li $20 10000
li $10 12
sll $10 $10 2
sw $20 0x10040010($10)
li $20 20000
li $10 13
sll $10 $10 2
sw $20 0x10040010($10)
li $20 30000
li $10 14
sll $10 $10 2
sw $20 0x10040010($10)
li $20 0
li $10 3
mult $20 $10
mflo $21
li $20 1
li $10 3
mult $20 $10
mflo $11
sw $31 0($sp)
sw $21 -4($sp)
sw $11 -8($sp)
sll $21 $21 2
li $20 0x10040010
addu $21 $21 $20
sw $21 -12($sp)
sll $11 $11 2
li $10 0x10040010
addu $11 $11 $10
sw $11 -16($sp)
subi $sp $sp 20
jal swapFirst
addi $sp $sp 20
lw $31 0($sp)
lw $21 -4($sp)
lw $11 -16($sp)
lw $11 -8($sp)
lw $21 -12($sp)
sw $31 0($sp)
sw $20 -4($sp)
li $21 0x10040000
sw $21 -8($sp)
li $21 0x10040000
sw $21 -12($sp)
subi $sp $sp 16
jal swapFirst
addi $sp $sp 16
lw $31 0($sp)
lw $21 -8($sp)
lw $20 -4($sp)
lw $21 -12($sp)
sw $31 0($sp)
sw $20 -4($sp)
li $21 5
sw $21 -8($sp)
li $21 0
sw $21 -12($sp)
li $21 0x10040010
sw $21 -16($sp)
subi $sp $sp 20
jal getSumOfArray2
addi $sp $sp 20
lw $31 0($sp)
lw $20 -4($sp)
lw $21 -8($sp)
lw $21 -12($sp)
lw $21 -16($sp)
move $21 $2
sw $21 0x1004004c($0)
sw $31 0($sp)
sw $20 -4($sp)
li $21 5
sw $21 -8($sp)
li $21 1
sw $21 -12($sp)
li $21 0x10040010
sw $21 -16($sp)
subi $sp $sp 20
jal getSumOfArray2
addi $sp $sp 20
lw $21 -8($sp)
lw $21 -16($sp)
lw $31 0($sp)
lw $20 -4($sp)
lw $21 -12($sp)
move $21 $2
sw $21 0x10040050($0)
sw $31 0($sp)
sw $20 -4($sp)
li $21 5
sw $21 -8($sp)
li $21 2
sw $21 -12($sp)
li $21 0x10040010
sw $21 -16($sp)
subi $sp $sp 20
jal getSumOfArray2
addi $sp $sp 20
lw $21 -12($sp)
lw $21 -16($sp)
lw $31 0($sp)
lw $20 -4($sp)
lw $21 -8($sp)
move $21 $2
sw $21 0x10040054($0)
li $21 1
sw $21 0x10040058($0)
li $21 2
sw $21 0x1004005c($0)
li $21 3
sw $21 0x10040060($0)
la $4 str14
li $2 4
syscall
lw $21 0x10040058($0)
move $4 $21
li $2 1
syscall
la $4 str15
li $2 4
syscall
lw $21 0x1004004c($0)
move $4 $21
li $2 1
syscall
la $4 str16
li $2 4
syscall
lw $21 0x1004005c($0)
move $4 $21
li $2 1
syscall
la $4 str17
li $2 4
syscall
lw $21 0x10040050($0)
move $4 $21
li $2 1
syscall
la $4 str18
li $2 4
syscall
lw $21 0x10040060($0)
move $4 $21
li $2 1
syscall
la $4 str19
li $2 4
syscall
lw $21 0x10040054($0)
move $4 $21
li $2 1
syscall
la $4 str20
li $2 4
syscall
la $4 1
li $2 1
syscall
la $4 str21
li $2 4
syscall
li $21 1
sw $21 0x10040064($0)
li $21 2
sw $21 0x10040068($0)
li $21 3
sw $21 0x1004006c($0)
lw $21 0x10040064($0)
move $4 $21
li $2 1
syscall
la $4 str22
li $2 4
syscall
lw $21 0x10040068($0)
move $4 $21
li $2 1
syscall
la $4 str23
li $2 4
syscall
lw $21 0x1004006c($0)
move $4 $21
li $2 1
syscall
la $4 str24
li $2 4
syscall
li $21 1
sw $21 0x10040070($0)
li $21 0
sw $21 0x10040074($0)
w_cond_begin_9:
lw $21 0x10040074($0)
lw $11 0x10040070($0)
slt $22 $21 $11
li $21 0
beq $22 $21 while_end_9
w_cond_end_9:
while_begin_9:
block_begin_35:
la $4 str25
li $2 4
syscall
lw $21 0x10040074($0)
li $11 1
addu $22 $21 $11
sw $22 0x10040074($0)
block_end_35:
j w_cond_begin_9
while_end_9:
li $2 0
li $2 10
syscall
block_end_34:
myfun1:
li $2 0
jr $31
jr $31
myfun2:
jr $31
myfun3:
jr $31
jr $31
adder:
lw $20 4($sp)
li $10 1
addu $21 $20 $10
move $2 $21
jr $31
jr $31
swapFirst:
li $21 0
sll $21 $21 2
lw $10 8($sp)
addu $10 $10 $21
lw $20 0($10)
sw $20 0($sp)
li $10 0
sll $10 $10 2
lw $20 4($sp)
addu $20 $20 $10
lw $20 0($20)
li $10 0
sll $10 $10 2
lw $21 8($sp)
addu $21 $21 $10
sw $20 0($21)
lw $20 0($sp)
li $10 0
sll $10 $10 2
lw $11 4($sp)
addu $11 $11 $10
sw $20 0($11)
jr $31
array2Fun:
li $20 0
li $10 3
mult $20 $10
mflo $21
li $20 1
addu $10 $20 $21
li $20 0
li $21 3
mult $20 $21
mflo $11
li $20 1
addu $21 $20 $11
sll $10 $10 2
lw $11 8($sp)
addu $11 $11 $10
lw $20 0($11)
sll $21 $21 2
lw $11 4($sp)
addu $11 $11 $21
lw $10 0($11)
addu $21 $20 $10
move $2 $21
jr $31
jr $31
testWhile:
w_cond_begin_0:
li $20 0
li $10 0
beq $20 $10 while_end_0
w_cond_end_0:
while_begin_0:
block_begin_0:
block_end_0:
j w_cond_begin_0
while_end_0:
li $20 10
sw $20 0($sp)
w_cond_begin_1:
li $20 0
lw $10 0($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_1
w_cond_end_1:
while_begin_1:
block_begin_1:
lw $20 0($sp)
li $10 3
subu $21 $20 $10
sw $21 0($sp)
block_end_1:
j w_cond_begin_1
while_end_1:
lw $20 0($sp)
li $10 -2
xor $21 $20 $10
sltiu $20 $21 1
li $10 1
subu $21 $10 $20
li $20 0
beq $21 $20 if_end_0
if_begin_0:
block_begin_2:
la $4 str0
li $2 4
syscall
block_end_2:
if_end_0:
li $20 4
sw $20 -4($sp)
li $20 2
sw $20 -8($sp)
w_cond_begin_2:
li $20 0
lw $10 -4($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_2
w_cond_end_2:
while_begin_2:
block_begin_3:
lw $20 -4($sp)
li $10 1
subu $21 $20 $10
sw $21 -4($sp)
lw $20 -8($sp)
li $10 2
mult $20 $10
mflo $21
sw $21 -8($sp)
lw $20 -4($sp)
li $10 1
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_1
if_begin_1:
block_begin_4:
j while_end_2
block_end_4:
if_end_1:
block_end_3:
j w_cond_begin_2
while_end_2:
lw $20 -8($sp)
li $10 16
xor $21 $20 $10
sltiu $20 $21 1
li $10 1
subu $21 $10 $20
li $20 0
beq $21 $20 if_end_2
if_begin_2:
block_begin_5:
la $4 str1
li $2 4
syscall
block_end_5:
if_end_2:
li $20 3
sw $20 -12($sp)
li $20 6
sw $20 -4($sp)
w_cond_begin_3:
li $20 0
lw $10 -4($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_3
w_cond_end_3:
while_begin_3:
block_begin_6:
lw $20 -4($sp)
li $10 1
subu $21 $20 $10
sw $21 -4($sp)
lw $20 -4($sp)
li $10 2
div $20 $10
mfhi $21
li $20 1
xor $10 $21 $20
sltiu $20 $10 1
li $10 0
beq $20 $10 if_end_3
if_begin_3:
block_begin_7:
j w_cond_begin_3
block_end_7:
if_end_3:
lw $20 -12($sp)
li $10 3
mult $20 $10
mflo $21
sw $21 -12($sp)
block_end_6:
j w_cond_begin_3
while_end_3:
lw $20 -12($sp)
li $10 81
xor $21 $20 $10
sltiu $20 $21 1
li $10 1
subu $21 $10 $20
li $20 0
beq $21 $20 if_end_4
if_begin_4:
block_begin_8:
la $4 str2
li $2 4
syscall
block_end_8:
if_end_4:
li $20 9
sw $20 -16($sp)
w_cond_begin_4:
li $20 0
lw $10 -16($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_4
w_cond_end_4:
while_begin_4:
lw $20 -16($sp)
li $10 10
subu $21 $20 $10
sw $21 -16($sp)
j w_cond_begin_4
while_end_4:
w_cond_begin_5:
li $20 1
li $10 0
beq $20 $10 while_end_5
w_cond_end_5:
while_begin_5:
j while_end_5
j w_cond_begin_5
while_end_5:
jr $31
testIf:
li $20 9
sw $20 0($sp)
li $20 0
sw $20 -4($sp)
li $20 8
lw $10 0($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 if_end_5
if_begin_5:
block_begin_9:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
sw $21 -4($sp)
block_end_9:
j if_endAll_5
if_end_5:
block_begin_10:
lw $20 -4($sp)
li $10 10
subu $21 $20 $10
sw $21 -4($sp)
block_end_10:
if_endAll_5:
lw $20 0($sp)
li $10 9
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_6
if_begin_6:
block_begin_11:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
sw $21 -4($sp)
block_end_11:
if_end_6:
lw $20 0($sp)
li $10 10
slt $21 $20 $10
li $20 0
beq $21 $20 if_end_7
if_begin_7:
block_begin_12:
lw $20 0($sp)
li $10 20
slt $21 $20 $10
li $20 0
beq $21 $20 if_end_8
if_begin_8:
block_begin_13:
lw $20 0($sp)
li $10 30
slt $21 $20 $10
li $20 0
beq $21 $20 if_end_9
if_begin_9:
block_begin_14:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
sw $21 -4($sp)
block_end_14:
if_end_9:
block_end_13:
j if_endAll_8
if_end_8:
block_begin_15:
lw $20 -4($sp)
li $10 100
subu $21 $20 $10
sw $21 -4($sp)
block_end_15:
if_endAll_8:
block_end_12:
if_end_7:
lw $20 0($sp)
li $10 10
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_10
if_begin_10:
block_begin_16:
lw $20 -4($sp)
li $10 1000
subu $21 $20 $10
sw $21 -4($sp)
block_end_16:
j if_endAll_10
if_end_10:
lw $20 0($sp)
li $10 8
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_11
if_begin_11:
block_begin_17:
lw $20 -4($sp)
li $10 10000
subu $21 $20 $10
sw $21 -4($sp)
block_end_17:
j if_endAll_11
if_end_11:
lw $20 0($sp)
li $10 9
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_12
if_begin_12:
block_begin_18:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
sw $21 -4($sp)
block_end_18:
j if_endAll_12
if_end_12:
block_begin_19:
lw $20 -4($sp)
li $10 30000
subu $21 $20 $10
sw $21 -4($sp)
block_end_19:
if_endAll_12:
if_endAll_11:
if_endAll_10:
li $20 100
lw $10 0($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 if_end_13
if_begin_13:
block_begin_20:
lw $20 -4($sp)
li $10 3000
subu $21 $20 $10
sw $21 -4($sp)
block_end_20:
j if_endAll_13
if_end_13:
block_begin_21:
lw $20 0($sp)
li $10 9
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_14
if_begin_14:
block_begin_22:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
sw $21 -4($sp)
block_end_22:
if_end_14:
block_end_21:
if_endAll_13:
la $4 str3
li $2 4
syscall
lw $20 -4($sp)
move $4 $20
li $2 1
syscall
la $4 str4
li $2 4
syscall
jr $31
testIO:
li $20 20
sw $20 0($sp)
li $2 5
syscall
sw $2 0($sp)
li $20 10
sw $20 -4($sp)
li $20 20
sw $20 -12($sp)
li $2 5
syscall
sw $2 -8($sp)
lw $20 -12($sp)
move $4 $20
li $2 1
syscall
la $4 str5
li $2 4
syscall
li $2 5
syscall
sw $2 -20($sp)
lw $20 -20($sp)
move $4 $20
li $2 1
syscall
la $4 str6
li $2 4
syscall
jr $31
testRecurrence:
lw $20 4($sp)
li $10 0
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_15
if_begin_15:
block_begin_23:
li $2 1
jr $31
block_end_23:
if_end_15:
lw $20 4($sp)
li $10 1
xor $21 $20 $10
sltiu $20 $21 1
li $10 0
beq $20 $10 if_end_16
if_begin_16:
block_begin_24:
li $20 1
sw $20 0($sp)
block_end_24:
j if_endAll_16
if_end_16:
block_begin_25:
lw $20 4($sp)
li $10 2
subu $21 $20 $10
sw $31 -4($sp)
sw $21 -8($sp)
sw $21 -12($sp)
subi $sp $sp 16
jal testRecurrence
addi $sp $sp 16
lw $21 -12($sp)
lw $21 -8($sp)
lw $31 -4($sp)
move $20 $2
sw $20 0($sp)
block_end_25:
if_endAll_16:
lw $20 4($sp)
li $10 1
subu $21 $20 $10
sw $31 -4($sp)
sw $21 -8($sp)
sw $21 -12($sp)
subi $sp $sp 16
jal testRecurrence
addi $sp $sp 16
lw $21 -12($sp)
lw $21 -8($sp)
lw $31 -4($sp)
move $20 $2
lw $10 0($sp)
mult $10 $20
mflo $21
lw $20 4($sp)
mult $21 $20
mflo $10
lw $20 4($sp)
li $21 1
subu $11 $20 $21
sw $31 -4($sp)
sw $10 -8($sp)
sw $11 -12($sp)
sw $11 -16($sp)
subi $sp $sp 20
jal testRecurrence
addi $sp $sp 20
lw $11 -16($sp)
lw $31 -4($sp)
lw $11 -12($sp)
lw $10 -8($sp)
move $20 $2
mult $10 $20
mflo $21
move $2 $21
jr $31
jr $31
testBlock:
li $20 600
sw $20 0($sp)
block_begin_26:
li $20 900
sw $20 -4($sp)
block_begin_27:
lw $20 -4($sp)
sw $20 -8($sp)
li $20 7
sw $20 -12($sp)
lw $20 -8($sp)
lw $10 -12($sp)
addu $21 $20 $10
sw $21 -8($sp)
block_begin_28:
li $20 1
sw $20 -16($sp)
li $20 10
lw $10 -16($sp)
mult $20 $10
mflo $21
lw $20 -8($sp)
addu $10 $20 $21
sw $10 -8($sp)
block_end_28:
block_begin_29:
li $20 2
sw $20 -20($sp)
li $20 300
lw $10 -20($sp)
mult $20 $10
mflo $21
lw $20 -8($sp)
addu $10 $20 $21
sw $10 -8($sp)
block_end_29:
block_begin_30:
li $20 3
sw $20 -24($sp)
block_end_30:
lw $20 -8($sp)
lw $10 -12($sp)
addu $21 $20 $10
sw $21 -8($sp)
la $4 str7
li $2 4
syscall
lw $20 -8($sp)
move $4 $20
li $2 1
syscall
la $4 str8
li $2 4
syscall
block_end_27:
block_end_26:
jr $31
clean:
li $20 0
sw $20 0($sp)
w_cond_begin_6:
lw $20 0($sp)
lw $10 16($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_6
w_cond_end_6:
while_begin_6:
block_begin_31:
lw $20 20($sp)
lw $10 0($sp)
sll $10 $10 2
lw $21 12($sp)
addu $21 $21 $10
sw $20 0($21)
lw $20 0($sp)
li $10 1
addu $21 $20 $10
sw $21 0($sp)
block_end_31:
j w_cond_begin_6
while_end_6:
li $2 0
jr $31
jr $31
getSumOfArray:
li $20 0
sw $20 0($sp)
li $20 0
sw $20 -4($sp)
w_cond_begin_7:
lw $20 0($sp)
lw $10 8($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_7
w_cond_end_7:
while_begin_7:
block_begin_32:
lw $20 -4($sp)
lw $11 0($sp)
sll $11 $11 2
lw $21 4($sp)
addu $21 $21 $11
lw $10 0($21)
addu $21 $20 $10
sw $21 -4($sp)
lw $20 0($sp)
li $10 1
addu $21 $20 $10
sw $21 0($sp)
block_end_32:
j w_cond_begin_7
while_end_7:
lw $20 -4($sp)
li $10 1
addu $21 $20 $10
li $20 1
li $10 1
mult $20 $10
mflo $11
li $20 1
div $11 $20
mflo $10
subu $20 $21 $10
move $2 $20
jr $31
jr $31
getSumOfArray2:
li $20 0
sw $20 0($sp)
w_cond_begin_8:
li $20 0
lw $10 12($sp)
slt $21 $20 $10
li $20 0
beq $21 $20 while_end_8
w_cond_end_8:
while_begin_8:
block_begin_33:
lw $20 12($sp)
li $10 1
subu $21 $20 $10
li $20 3
mult $21 $20
mflo $10
lw $20 8($sp)
addu $21 $20 $10
lw $20 0($sp)
sll $21 $21 2
lw $11 4($sp)
addu $11 $11 $21
lw $10 0($11)
addu $21 $20 $10
sw $21 0($sp)
lw $20 12($sp)
li $10 1
subu $21 $20 $10
sw $21 12($sp)
block_end_33:
j w_cond_begin_8
while_end_8:
lw $2 0($sp)
jr $31
jr $31
